
    volScalarField fieldP
    (
        IOobject
        (
            "fieldP",
            runTime.timeName(),
            mesh,
            IOobject::NO_READ,
            IOobject::AUTO_WRITE
        ),
        mesh,
        dimensionedScalar("zero", dimPressure, 0.0)
    );

// ERROR: 
// Info << "mesh.Vsc() " << mesh.Vsc().size() << endl; 
// mesh.Vsc()声明----> Foam::tmp<Foam::volScalarField::Internal> Foam::fvMesh::Vsc() const
// /OpenFOAM-v2306/src/finiteVolume/fvMesh/fvMeshGeometry.C
Info <<"-------------" << endl;
Info << "mesh.Vsc()() " << mesh.Vsc()().size() << endl;
// Info << mesh.Vsc()().internalField() << endl;
Info <<"-------------" << endl;
Info << "fieldP.primitiveFieldRef().size() " <<"\n" << fieldP.primitiveFieldRef().size() << endl;

Info <<"-------------" << endl;
Info << "fieldP.primitiveFieldRef() " <<"\n" << fieldP.primitiveFieldRef() << endl;

Info <<"-------------" << endl;
Info << "fieldP.internalField()" <<"\n" << fieldP.internalField() << endl;

Info <<"-------------" << endl;
Info << "fieldP.internalField().field()" <<"\n" << fieldP.internalField().field() << endl;

Info <<"-------------" << endl;
Info << "fieldP.internalField().size()" <<"\n" << fieldP.internalField().size() << endl;

Info <<"-------------" << endl;
Info << "fieldP.boundaryField().size()" <<"\n" << fieldP.boundaryField().size() << endl;

Info <<"-------------" << endl;
Info << "mesh.boundaryMesh().size()" <<"\n" << mesh.boundaryMesh().size() << endl;
Info << "with name: ";
forAll(mesh.boundaryMesh(), patchI)
{
  Info <<  mesh.boundaryMesh()[patchI].name() <<" ";
}
Info << "\n";


Info <<"-------------" << endl;
Info << "fieldP" <<"\n" << fieldP << endl;

Info <<"-------------" << endl;
Info << "fieldP.boundaryFieldRef()" <<"\n" << fieldP.boundaryFieldRef() << endl;

Info <<"-------------" << endl;
Info << "fieldP.boundaryField()" <<"\n" << fieldP.boundaryField() << endl;

Info <<"-------------" << endl;
Info << "fieldP.dimensions()" <<"\n" << fieldP.dimensions() << endl;



const scalarField x(mesh.C().component(vector::X));

fieldP.primitiveFieldRef().replace(0, 10);
fieldP.primitiveFieldRef().replace(1, 20);
fieldP.primitiveFieldRef().replace(2, sin(2*x));
fieldP.primitiveFieldRef().replace(3, 666.0);
fieldP.primitiveFieldRef().replace(3333, 66336.0);// 这里还是替换成功
// WARN:
// ./testField.h:40:36: warning: implicit conversion from 'int' to 
// 'Foam::direction' (aka 'unsigned char') changes value from 3333 to 5 [-Wconstant-conversion]
// fieldP.primitiveFieldRef().replace(3333, 66336.0);


Info <<"-------------" << endl;
// Info << "fieldP.primitiveFieldRef() " <<"\n" << fieldP.primitiveFieldRef() << endl;

//  68     vectorField& Uc = U.primitiveFieldRef();
//  69 
//  70     Uc.replace(vector::X, sin(2*pi*y)*sqr(sin(pi*x)));
//  71     Uc.replace(vector::Y, -sin(2*pi*x)*sqr(sin(pi*y)));
//  72     Uc.replace(vector::Z, sqr(1.0 - 2.0*r));

fieldP.write();


    // 创建一个向量场
    vectorField vecField(mesh.C().size(), vector::zero);

    // 打开一个文件用于写入向量场数据
    OFstream file("outputVectorField.dat");

    // 将向量场数据写入文件
    file << vecField;

    // 关闭文件
    // file.close();

    Info<< "向量场数据已写入文件outputVectorField.dat" << endl;

